//
//  JinDuVC.m
//  HxgProject
//
//  Created by hxg on 2018/4/7.
//  Copyright © 2018年 XMYY-19. All rights reserved.
//

#import "JinDuVC.h"
#import "JinDuCell.h"
#import "ApplyInfo.h"

@interface JinDuVC ()

// 显示的数组
@property (nonatomic, strong) NSMutableArray *showArr;

@end

@implementation JinDuVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = self.showTitleStr;
    [self.tableView registerClass:[JinDuCell class] forCellReuseIdentifier:@"MyCell"];
    
    [self.tableView registerNib:[UINib nibWithNibName:@"JinDuCell" bundle:nil] forCellReuseIdentifier:@"MyCell"];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.detailApplyArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    JinDuCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell" forIndexPath:indexPath];
    
    if (!cell)
    {
        cell = [[JinDuCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MyCell"];
    }
    
    // 对cell 进行简单地数据配置
    ApplyInfo *applyInfo = self.detailApplyArr[indexPath.row];
   
    cell.applyTimeInfo.text = applyInfo.applyTime;
    cell.currentStatus.text = [self getState:applyInfo.curState withTitle:self.showTitleStr];
    cell.currentStatus.textAlignment = NSTextAlignmentCenter;
    
    return cell;
}

- (NSString *)getState:(NSString *)stateStr withTitle:(NSString *)showTitleStr
{
    if ([showTitleStr isEqualToString:@"进度查询"]) {
        if ([stateStr isEqualToString:@"0"]) {
            return @"待审核";
        } else if ([stateStr isEqualToString:@"1"]) {
            return @"已审核";
        }
    } else if ([showTitleStr isEqualToString:@"还款查询"]) {
        if ([stateStr isEqualToString:@"0"]) {
            return @"待放款";
        } else if ([stateStr isEqualToString:@"1"]) {
            return @"已放款";
        } else if ([stateStr isEqualToString:@"2"]){
            return @"已还清";
        }
    }
    return @"";
}




@end
